package com.javakc.mes.order.dispordrls.controller;

import com.javakc.commonutils.api.APICODE;
import com.javakc.mes.order.dispordrls.entity.DispOrdRls;
import com.javakc.mes.order.dispordrls.service.DispOrdRlsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author ：史根根根根根键
 * @date ：2021/12/14
 * @description：
 * @modified By：
 * @version: 1.0.0
 */
@RequestMapping("/mes/dispordrls")
@RestController
@Api(tags = "煤矿调度指令")
public class DispOrdRlsController {
    @Autowired
    private DispOrdRlsService dispOrdRlsService;

    @GetMapping
    @ApiOperation("生产执行调度查询区域")
    public List<DispOrdRls> queryAll(){
        return dispOrdRlsService.queryAll();
    }

    @PostMapping
    @ApiOperation("生产执行调度新增区域")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderCode",value = "调度指令编号",readOnly = true),
            @ApiImplicitParam(name = "orderName",value = "指令名称",readOnly = true),
            @ApiImplicitParam(name = "orderPriority",value = "指令优先级",readOnly = true),
            @ApiImplicitParam(name = "orderStatus",value = "指令专业类型",readOnly = true),
            @ApiImplicitParam(name = "orderAccept",value = "指令接收方",readOnly = true),
            @ApiImplicitParam(name = "orderRelease",value = "指令下达人",readOnly = true),
            @ApiImplicitParam(name = "orderTransfer",value = "指令传达人",readOnly = true),
            @ApiImplicitParam(name = "acceptStatus",value = "受理提交状态",readOnly = true),
            @ApiImplicitParam(name = "doneStatus",value = "执行提交状态",readOnly = true),
            @ApiImplicitParam(name = "releaseTime",value = "下达时间",readOnly = true),
            @ApiImplicitParam(name = "orderDescript",value = "指令描述",readOnly = true),
            @ApiImplicitParam(name = "acceptSituation",value = "受理情况",readOnly = true),
            @ApiImplicitParam(name = "performStatus",value = "执行情况",readOnly = true),
    })
    public void insert(@RequestBody @Valid DispOrdRls dispOrdRls){
        dispOrdRlsService.saveOrUpdate(dispOrdRls);
    }

    @ApiOperation("生产执行调度保存区域")
    @PostMapping("save")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "主键id",readOnly = true),
            @ApiImplicitParam(name = "orderCode",value = "调度指令编号",readOnly = true),
            @ApiImplicitParam(name = "orderName",value = "指令名称",readOnly = true),
            @ApiImplicitParam(name = "orderPriority",value = "指令优先级",readOnly = true),
            @ApiImplicitParam(name = "orderStatus",value = "指令专业类型",readOnly = true),
            @ApiImplicitParam(name = "orderAccept",value = "指令接收方",readOnly = true),
            @ApiImplicitParam(name = "orderRelease",value = "指令下达人",readOnly = true),
            @ApiImplicitParam(name = "orderTransfer",value = "指令传达人",readOnly = true),
            @ApiImplicitParam(name = "acceptStatus",value = "受理提交状态",readOnly = true),
            @ApiImplicitParam(name = "doneStatus",value = "执行提交状态",readOnly = true),
            @ApiImplicitParam(name = "releaseTime",value = "下达时间",readOnly = true),
            @ApiImplicitParam(name = "orderDescript",value = "指令描述",readOnly = true),
            @ApiImplicitParam(name = "acceptSituation",value = "受理情况",readOnly = true),
            @ApiImplicitParam(name = "performStatus",value = "执行情况",readOnly = true),
    })
    public APICODE save(@RequestBody @Valid DispOrdRls dispOrdRls){
        dispOrdRlsService.saveOrUpdate(dispOrdRls);
        return APICODE.OK();
    }

    @DeleteMapping("{id}")
    @ApiOperation("生产执行调度删除区域")
    @ApiImplicitParam(name = "id",value ="主键id" ,readOnly = true)
    public void delete(@PathVariable String id){
        dispOrdRlsService.removeById(id);
    }

}
